<template>
  <a-tree-select show-search style="width: 100%" :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
    placeholder="请选择组织" allow-clear tree-default-expand-all multiple :tree-data="staffData" treeNodeFilterProp="label">
  </a-tree-select>
</template>
<script setup>
import { onMounted, ref, watch } from 'vue';
import { treeList, metaTree, myFilter } from "./dict.js"
const value = ref();
const staffData = ref()
onMounted(() => {
  treeList.forEach(item => {
    item.managerList = item.managerList.filter(obj => obj.isDisabled === false)
  })
  // console.log(array)
  treeList.forEach((item) => {
    item.children = [];
    item.disableCheckbox = true;
  });
  staffData.value = metaTree(treeList, "organizeId", "organizePId", "organizeName");
  setChildren(staffData.value);
  console.log("treeList", treeList)
  // return
  myFilter(staffData.value)
})
//获取员工
const setChildren = (arr) => {
  arr.forEach((item) => {
    if (item.managerList) {
      item.managerList.forEach((v) => {
        v.label = v.account + '-' + v.realName;
        v.value = item.organizeId + "#" + v.businessUid;
      });
      item.children = [...item.children, ...item.managerList];
      setChildren(item.children);
    }
  });
};
</script>